package StudyCode.summary.mycollection;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CreateUnmodifiableSetFromSet {
	public static void main(String[] argv) {
		System.out.println(set());
	}

	public static <T> Set<T> set(final T... elements) {
		final HashSet<T> set = new HashSet<T>(elements.length);
		Collections.addAll(set, elements);
		return Collections.unmodifiableSet(set);
	}

	public static <T> Set<T> set() {
		return new HashSet<T>();
	}

}
